<template>
  <div class="handBatch_generat_cost">

    <el-row>
      <el-col :span="24"><div class="title_generat_cost">发起收费项目</div></el-col>
    </el-row>

    <el-form
      class="generat-form"
      :rules="rules"
      ref="form"
      :model="form"
      label-width="200px"
      :label-position="labelPosition">
      <el-form-item label="项目类型：" prop="regionType">
        <el-select v-model="form.region" placeholder="请选择项目类型" style="width: 220px;">
          <el-option label="请选择项目类型" value=""></el-option>
          <el-option label="项目类型1" value="shanghai"></el-option>
          <el-option label="项目类型2" value="beijing"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="项目名称：" prop="regionName">
        <el-select v-model="form.region" placeholder="请选择收费项目" style="width: 220px;">
          <el-option label="请选择收费项目" value=""></el-option>
          <el-option label="收费项目1" value="shanghai"></el-option>
          <el-option label="收费项目2" value="beijing"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="请选择文件：" prop="upload">
        <el-upload
          v-model="form.upload"
          style="width: 220px;"
          action=""
          :on-change="handleChange"
          :file-list="fileList">
          <el-button size="small" type="primary">点击上传</el-button>
          <!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>-->
        </el-upload>
      </el-form-item>

      <!--TODO 批量下载-->

      <el-form-item>
        <el-button type="primary"  @click="submitForm('form')">发起缴费</el-button>
        <el-button class="btn-item-cancel"  @click="resetForm('form')">重置</el-button>
      </el-form-item>
    </el-form>


  </div>
</template>

<script>

  export default {
    data(){
      return{
        fileList: [
//          {
//            name: 'food.jpeg',
//            url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100',
//            status: 'finished'
//          },
//          {
//            name: 'food2.jpeg',
//            url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100',
//            status: 'finished'
//          }
        ],
        labelPosition:'left',
        form: {
          regionType: '',
          regionName: '',
          upload:''
        },
        rules: {
          regionType: [
            { required: true, message: '请选择项目类型', trigger: 'change' }
          ],
          regionName: [
            { required: true, message: '请选择收费项目', trigger: 'change' }
          ],
          upload: [
            { required: true, message: '请选择文件', trigger: 'change' }
          ]
        }
      }
    },
    methods:{
      submitForm(formName) {
//        this.$refs[formName].validate((valid) => {
        this.$refs[formName].validate(
          function(valid) {
            if (valid) {
              alert('submit!');
            } else {
//            console.log('error submit!!');
              return false;
            }
          });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      },
      handleChange(file, fileList) {
        this.fileList3 = fileList.slice(-3);
      }
    }
  }
</script>

<style>
  .handBatch_generat_cost .title_generat_cost{
    height: 60px;
    line-height: 60px;
    font-size: 18px;
    padding-left: 30px;
    margin-bottom: 10px;
    color: #333333;
    background: #ffffff;
  }
  .handBatch_generat_cost .generat-form{
    background: #ffffff;
    padding: 50px 0 50px 30px;
  }
  .handBatch_generat_cost .generat-form label.el-form-item__label{
    font-size: 16px;
    color: #666666;
  }
  .handBatch_generat_cost .generat-form .el-form-item{
    margin-bottom: 50px;
  }
  .handBatch_generat_cost .generat-form .btn-item-cancel{
    margin-left: 100px;
  }
</style>
